<?php
require "model/log.model.php";
session_start();
if(isset($_POST["username"])){
	 $username = $_POST["username"];
	 $password = $_POST["password"];
	 $rs=logModel::login($username,$password);
  if($rs -> rowCount()){
      $_SESSION['username'] = $username;
	   echo "<script> alert('登入成功');parent.location.href='../index.php';</script>"; 
	   
	}
	else{
	   echo "<script> alert('登入失败,用户名或密码错误');parent.location.href='../login.php';</script>"; 
	}
	require "view/log.tpl.php";
}else{
require "view/log.tpl.php";
}

?>